package cn.liwq.demo.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.RoundingMode;

/**
 * 浮点数json格式化
 *
 * @author liweiqiang
 * @date 2023-02-013
 */
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ScaleFormatter {
  /** 精度，默认2位 */
  int scale() default 2;

  /** 舍入模式，默认：四舍五入 */
  RoundingMode roundingMode() default RoundingMode.HALF_UP;
}
